import 'package:flutter/material.dart';
import 'widgets/new_sale_section.dart';
import 'widgets/sales_history_section.dart';
import 'widgets/customers_section.dart';
import 'widgets/sales_analytics_section.dart';

class SalesManagementScreen extends StatefulWidget {
  const SalesManagementScreen({Key? key}) : super(key: key);

  @override
  State<SalesManagementScreen> createState() => _SalesManagementScreenState();
}

class _SalesManagementScreenState extends State<SalesManagementScreen> with SingleTickerProviderStateMixin {
  late TabController _tabController;
  
  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 4, vsync: this);
  }

  @override
  void dispose() {
    _tabController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('مال سېتىش باشقۇرۇش'),
        centerTitle: true,
        backgroundColor: const Color(0xFF223152),
        bottom: TabBar(
          controller: _tabController,
          isScrollable: true,
          indicatorColor: Colors.white,
          labelColor: Colors.white,
          unselectedLabelColor: Colors.white70,
          tabs: const [
            Tab(
              icon: Icon(Icons.shopping_cart),
              text: 'يېڭى سودا',
            ),
            Tab(
              icon: Icon(Icons.history),
              text: 'سودا خاتىرىسى',
            ),
            Tab(
              icon: Icon(Icons.people),
              text: 'خېرىدارلار',
            ),
            Tab(
              icon: Icon(Icons.analytics),
              text: 'سودا ئانالىزى',
            ),
          ],
        ),
      ),
      body: Container(
        color: const Color(0xFFF5F6FA),
        child: TabBarView(
          controller: _tabController,
          children: const [
            NewSaleSection(),
            SalesHistorySection(),
            CustomersSection(),
            SalesAnalyticsSection(),
          ],
        ),
      ),
    );
  }
} 